package com.example.zuoye1023.view

import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.blankj.utilcode.util.ToastUtils
import com.example.rikao1023.base.BaseActivity
import com.example.rikao1023.viewmodel.LoginViewmodel
import com.example.zuoye1023.R
import com.example.zuoye1023.databinding.ActivityLogBinding

@Route(path = "/login/LoginActivity")
class LogActivity : BaseActivity<ActivityLogBinding,LoginViewmodel>(R.layout.activity_log,
    LoginViewmodel()
) {
    override fun initdata() {

        viewmodel.successlogin.observe(this){
            ToastUtils.showShort(it.message)

        }
    }

    override fun initview() {

        binding.okLogin.setOnClickListener {
            var map=HashMap<String,String>()
            map["username"]=binding.etName.text.toString()
            map["password"]=binding.etPassword.text.toString()
            viewmodel.login(map)
        }

        binding.goreg.setOnClickListener {
            ARouter.getInstance().build("/reg/RegActivity")
                .navigation()
        }
    }


}